import com.sun.scenario.effect.impl.sw.java.JSWColorAdjustPeer;

import java.util.Scanner;
public class test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.printf("%d", sum(n));
    }
    public static int sum(int x) {
        if(x==0) return 0;
        return x % 10 + sum(x/10);
    }
    public static int add(int x,int y) {
        return x+y;
    }
    public static void main9(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        System.out.println("x+y="+add(x,y));
    }
    public static void main8(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 31; i >= 0; i-=2) {
            System.out.print(((n>>>i)&1)+"  ");
        }
        System.out.println();
        for (int i = 30; i >= 0 ; i-=2) {
            System.out.print(((n>>>i)&1)+"  ");
        }
    }
    public static void main7(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        int count = 0;
        while (num!=0) {
            num &= num-1;
            count++;
        }
        System.out.println("这个数字中二进制中1有"+count+"个");
    }
    public static void main6(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int abc = scanner.nextInt();
        for (int num = 0; num <= abc; num++) {
            int count = 0;
            int tem = num;
            while(tem!=0) {
                count++;
                tem /= 10;
            }
            int sum = 0;
            tem = num;
            while(tem!=0) {
                sum += Math.pow(tem % 10,count);
                tem /= 10;
            }
            if(sum==num)
                System.out.println(num+"对的");
        }
    }
    public static void main5(String[] args) {
        double sum = 1.0;
        int flag = -1;
        for (int i = 2; i <= 100; i++) {
            sum += 1.0/i*flag;
            flag = -flag;
        }
        System.out.println(sum);
    }
    public static void main4(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入两个数字 : ");
        int num1 = scanner.nextInt();
        int num2 = scanner.nextInt();
        while(num2!=0) {
            int tem = num1%num2;
            num1 = num2;
            num2 = tem;
        }
        System.out.println(num1+"是两个数字的最大公约数");
    }
 /*       public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            System.out.print("输入一个数字（k）：");
            int k = scanner.nextInt();

            for (int currentNumber = 2; currentNumber <= k; currentNumber++) {
                boolean isPrime = true;

                for (int i = 2; i <= Math.sqrt(currentNumber); i++) {
                    if (currentNumber % i == 0) {
                        isPrime = false;
                        break;
                    }
                }

                if (isPrime) {
                    System.out.println(currentNumber + " 是素数");
                }
            }
        }
    }
*/
 public static void main3(String[] args) {
     Scanner scanner = new Scanner(System.in);
     System.out.print("输入一个数字（k）：");
     int k = scanner.nextInt();

     for (int currentNumber = 2; currentNumber <= k; currentNumber++) {
         boolean isPrime = true;

         for (int i = 2; i <= Math.sqrt(currentNumber); i++) {
             if (currentNumber % i == 0) {
                 isPrime = false;
                 break;
             }
         }

         if (isPrime) {
             System.out.println(currentNumber + " 是素数");
         }
     }
 }
    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int k = scanner.nextInt();
        for (int j = 2; j <= k; j++) {
            int flag = 0;
            for (int i = 2; i <= Math.sqrt(j); i++) {
                if(j%i==0) {
                    flag = 1;
                    break;
                }
            }
            if(flag==0) {
                System.out.println(j+"是素数");
            }
        }

    }
    public static void main1(String[] args) {
        int count = 0;
        for(int i = 0; i<=100 ; i++) {
            int num = i;
            while (num != 0) {
                if (num % 10 == 9) {
                    count++;
                    break;
                }
                num /= 10;
            }
        }
        System.out.println(count);
    }
}
